﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;

namespace LandPortMoblieWeb.Models
{
    /// <summary>
    /// 系统用户
    /// </summary>
    [Serializable]
    public class User {
        /// <summary>
        /// 数据库主键
        /// </summary>
        [JsonProperty("id")]
        public string Id { get; set; }


        [Required]
        [Display(Name = "用户名")]
        [JsonProperty("loginName")]
        public string LoginName { get; set; }

        /// <summary>
        /// 用户姓名
        /// </summary>
        [JsonProperty("name")]
        public string Name { get; set; }

        /// <summary>
        /// 登录密码
        /// </summary>
        [Required]
        [Display(Name = "密码")]
        [DataType(DataType.Password)]
        public string Password { get; set; }

        /// <summary>
        /// 组织机构id
        /// </summary>
        public string OrgId { get; set; }

        [JsonProperty("enabled")]
        public bool Enabled { get; set; }

        [JsonProperty("orgCode")]
        public string OrgCode { get; set; }

        [JsonProperty("orgFullName")]
        public string OrgFullName { get; set; }

        public override string ToString() {
            return string.Format("Id = {0}, 登录名 = {1}, 姓名 = {2}, 编码 = {3}, 能否登录 = {4}", Id, LoginName, Name, OrgCode, Enabled);
        }
    }
}